<template>
  <a-drawer
    :open="show"
    :title="$t('realSyncDialog.Batchbtn')"
    @close="closes"
    width="60%"
    footer=""
    :closable="false"
    :maskClosable="false"
  >
    <template #extra>
      <CloseOutlined @click="closes" :loading="loading" />
    </template>
    <a-row style="margin: 20px 0">
      <a-col>
        <a-button
          type="primary"
          style="margin-right: 10px"
          @click="typeBatch = 'start'"
          >{{ $t("realSyncDialog.start") }}</a-button
        >
        <a-button
          type="primary"
          style="margin-right: 10px"
          @click="typeBatch = 'stop'"
          >{{ $t("realSyncDialog.stop") }}</a-button
        >
        <Tooltip :title="istype ? '' : $t('realSyncDialog.plsrcInfo1')">
          <a-button
            type="primary"
            style="margin-right: 10px"
            @click="typeBatch = 'run'"
            :disabled="!istype"
            >{{ $t("realSyncDialog.run") }}</a-button
          >
        </Tooltip>

        <a-button type="primary" style="margin-right: 10px" disabled>{{
          $t("realSyncDialog.deploy")
        }}</a-button
        ><a-button
          type="primary"
          @click="batcResetfn"
          style="margin-right: 10px; margin-bottom: 10px"
          >{{ $t("realSyncDialog.reset") }}</a-button
        >
        <a-button type="primary" style="margin-right: 10px" disabled>{{
          $t("realSyncDialog.update")
        }}</a-button>
        <a-dropdown :trigger="['click']" disabled>
          <template #overlay>
            <a-menu @click="handleMenuClick">
              <a-menu-item key="1" :icon="h(PlayCircleOutlined)">{{
                $t("realSyncDialog.batchadd")
              }}</a-menu-item>
              <a-menu-item key="2" :icon="h(SyncOutlined)">{{
                $t("realSyncDialog.batchstopstart")
              }}</a-menu-item>
              <a-menu-item key="3" :icon="h(StopOutlined)">{{
                $t("realSyncDialog.batchdelc")
              }}</a-menu-item>
              <a-menu-item key="4" :icon="h(ReloadOutlined)">{{
                $t("realSyncDialog.batchload")
              }}</a-menu-item>
            </a-menu>
          </template>
          <a-button
            @click="isSearchShow = !isSearchShow"
            style="margin-right: 10px"
            type="primary"
            >{{ $t("realSyncDialog.cbtn") }}
            <DownOutlined v-if="!isSearchShow" />
            <UpOutlined v-else
          /></a-button>
        </a-dropdown>
        <a-dropdown :trigger="['click']">
          <template #overlay>
            <a-menu @click="handleMenuClick">
              <a-menu-item disabled key="1" :icon="h(PlayCircleOutlined)">{{
                $t("realSyncDialog.dc")
              }}</a-menu-item>
              <a-menu-item disabled key="2" :icon="h(SyncOutlined)">{{
                $t("realSyncDialog.rwb")
              }}</a-menu-item>
              <a-menu-item disabled key="3" :icon="h(StopOutlined)">{{
                $t("realSyncDialog.reh")
              }}</a-menu-item>
              <a-menu-item disabled key="4" :icon="h(ReloadOutlined)">{{
                $t("realSyncDialog.batcheditpar")
              }}</a-menu-item>
              <a-menu-item disabled key="5" :icon="h(DeleteOutlined)">{{
                $t("realSyncDialog.pedit")
              }}</a-menu-item>
              <a-menu-item disabled key="6" :icon="h(ToTopOutlined)">{{
                $t("realSyncDialog.sdrz")
              }}</a-menu-item>
              <a-menu-item key="delete" :icon="h(DesktopOutlined)">{{
                $t("realSyncDialog.dey")
              }}</a-menu-item>
            </a-menu>
          </template>
          <a-button type="primary" @click="isSearchtwo = !isSearchtwo"
            >{{ $t("realSyncDialog.more") }}
            <DownOutlined v-if="!isSearchtwo" />
            <UpOutlined v-else
          /></a-button>
        </a-dropdown>
      </a-col>
    </a-row>
    <a-card v-loading="leadingInfo.loading">
      <a-row
        style="margin-bottom: 20px"
        v-if="typeBatch != 'reset' || typeBatch != 'delete'"
      >
        <a-col v-for="(item, i) in headerBtn[typeBatch]" style="display: flex">
          <a-button
            @click="batchExecCommand(typeBatch, item.execType)"
            type="primary"
            style="margin-right: 10px; font-size: 14px"
            >{{ item.name }}</a-button
          >
          <template v-if="typeBatch == 'run'">
            <Select
              v-model:value="syncSceneValue"
              :placeholder="$t('realSyncDialog.Synchronousscene')"
              allowClear
              @change="getSceneValueBySceneID"
              style="width: 15rem"
            >
              <Select.Option
                v-for="item in syncScene"
                :key="item.index"
                :value="item.id"
                >{{ item.show_info }}
              </Select.Option>
            </Select>
            <a-popover :title="$t('realSyncDialog.taskStat')">
              <template #content>
                <p>
                  {{
                    syncScene.find((item) => item.id == syncSceneValue)
                      ?.show_desc
                  }}
                </p>
              </template>
              <a-button type="text">
                <template #icon>
                  <QuestionCircleOutlined style="color: #ccc" />
                </template>
              </a-button>
            </a-popover>
            <Form layout="inline" :model="formState">
              <Form.Item
                v-for="(item, index) in syncInputParams"
                :label="item.child_name"
                :key="index"
              >
                <Input
                  v-model:value="formState[index]"
                  :placeholder="item.child_value"
                />
              </Form.Item>
            </Form>
          </template>
        </a-col>
      </a-row>
      <a-row class="rowmax" v-if="start_stop">
        <a-col style="margin-top: 6px">
          <div>
            {{
              typebtn == "run"
                ? $t("realSyncDialog.run")
                : typebtn == "stop"
                ? $t("realSyncDialog.stop")
                : typebtn == "start"
                ? $t("realSyncDialog.start")
                : typebtn == "reset"
                ? $t("realSyncDialog.reset")
                : $t("realSyncDialog.dey")
            }}{{ $t("realSyncDialog.plan")
            }}<span>（{{ status_obj.num + "/" + tableNew.length }}）</span>
          </div>
        </a-col>
        <a-col>
          <a-button
            style="color: #67c23a"
            type="link"
            :disabled="status_obj.calculate != '100'"
            @click="successBtn('success')"
            >{{ $t("realSyncDialog.success") }}
            {{ status_obj.success }}</a-button
          >
        </a-col>
        <a-col>
          <a-button
            style="color: #f56c6c"
            type="link"
            :disabled="status_obj.calculate != '100'"
            @click="successBtn('error')"
            >{{ $t("realSyncDialog.error") }} {{ status_obj.error }}</a-button
          >
        </a-col>
        <!-- <a-col>
        <p>跳过<span>  0</span></p>
      </a-col> -->
      </a-row>
      <div v-if="start_stop" style="display: flex">
        <a-progress :percent="status_obj.calculate" />
        <a-spin size="large" v-if="status_obj.calculate != '100'" />
      </div>
      <a-table
        :pagination="false"
        class="ant-table-striped"
        :dataSource="leadingInfo.tableData"
        :columns="leadingInfo.columns"
      >
        <template #bodyCell="{ column, text, record }">
          <template v-if="column.dataIndex == 'source_status'">
            <div class="BadgeWapper">
              <Tooltip :title="statusFn(record.source_status)">
                <PlayCircleOutlined
                  v-if="record.source_status == 'start'"
                  class="statusPlay"
                />
                <PauseCircleOutlined
                  v-else-if="record.source_status == 'stop'"
                  class="notStatus"
                />
                <ClockCircleFilled
                  v-else-if="record.source_status == 'no_start'"
                  class="myNotStatus"
                />
                <ExclamationCircleOutlined
                  v-else-if="record.source_status == 'error'"
                  class="notStop"
                />
                <ExclamationCircleOutlined
                  v-else-if="record.source_status == 'core'"
                  class="notStop"
                />
                <img
                  v-else-if="record.source_status == 'run'"
                  class="statusPlay run"
                  :src="loadImg(`flow/table/run.png`)"
                  alt=""
                />
                <span v-else>--</span>
              </Tooltip>
            </div>
          </template>
          <template v-if="column.dataIndex == 'target_status'">
            <div class="BadgeWapper">
              <Tooltip :title="statusFn(record.target_status)">
                <PlayCircleOutlined
                  v-if="record.target_status == 'start'"
                  class="statusPlay"
                />
                <PauseCircleOutlined
                  v-else-if="record.target_status == 'stop'"
                  class="notStatus"
                />
                <ExclamationCircleOutlined
                  v-else-if="record.target_status == 'error'"
                  class="notStop"
                />
                <ExclamationCircleOutlined
                  v-else-if="record.source_status == 'core'"
                  class="notStop"
                />
                <ClockCircleFilled
                  v-else-if="record.target_status == 'no_start'"
                  class="myNotStatus"
                />
                <img
                  v-else-if="record.target_status == 'run'"
                  class="statusPlay run"
                  :src="loadImg(`flow/table/run.png`)"
                  alt=""
                />
                <span v-else>--</span>
              </Tooltip>
            </div>
          </template>
          <template v-if="column.dataIndex === 'source_type'">
            <img
              class="source_info_img"
              :class="{ null_img: !record.source_type }"
              :src="
                loadImg(
                  `smallIcon/${
                    record.source_type ? record.source_type : 'null'
                  }.png`
                )
              "
              alt=""
            />
          </template>
          <template v-if="column.dataIndex === 'target_type'">
            <Badge
              :number-style="{ backgroundColor: 'orange' }"
              :count="getDtType(record.target_type).split(',').length"
            >
              <img
                class="source_info_img"
                :class="{ null_img: !record.target_type }"
                :src="
                  loadImg(
                    `smallIcon/${
                      getDtType(record.target_type).split(',').shift()
                        ? getDtType(record.target_type).split(',').shift()
                        : 'null'
                    }.png`
                  )
                "
                alt=""
              />
            </Badge>
          </template>
          <template
            v-if="
              column.key == 'operation' &&
              (record.target_status == 'start' ||
                record.target_status == 'stop' ||
                record.target_status == 'run' ||
                record.target_status == 'error' ||
                record.cmd_type) &&
              typebtn != 'delete' &&
              typebtn != 'reset' &&
              typebtn != 'run'
            "
          >
            <a-button type="link" @click="lookLogs(record)">{{
              $t("realSyncDialog.view")
            }}</a-button>
          </template>
        </template>
      </a-table>
    </a-card>
    <!-- //日志查看 -->
    <a-modal
      v-model:open="open"
      :title="$t('realSyncDialog.logview')"
      @ok="handleOk"
      width="60vh"
      footer=""
      :maskClosable="false"
    >
      <a-tabs v-model:activeKey="activeKey" v-loading="activeding">
        <a-tab-pane
          key="1"
          :tab="$t('realSyncDialog.src')"
          v-if="sourceLog && sourceLog.length > 0"
        >
          <a-card style="max-height: 40vh; overflow: auto">
            <p v-for="(item, i) in sourceLog">{{ item }}</p>
          </a-card>
        </a-tab-pane>
        <a-tab-pane
          key="2"
          :tab="$t('realSyncDialog.tar')"
          force-render
          v-if="targetLog.length > 0 || targetstr.length > 0"
        >
          <a-card
            style="max-height: 40vh; overflow: auto; padding-top: 0"
            v-if="targetstr.length > 0"
          >
            <a-tabs v-model:activeKey="actives">
              <a-tab-pane
                v-for="(int, i) in targetstr"
                :key="i + 1"
                :tab="
                  int.db_custom_name == 'target'
                    ? $t('realSyncDialog.zh')
                    : int.db_custom_name
                "
              >
                <p v-for="(items, index) in int.logList">{{ items }}</p>
              </a-tab-pane>
            </a-tabs>
          </a-card>
          <!-- 一对一 -->
          <a-card
            style="max-height: 40vh; overflow: auto"
            v-if="targetLog.length > 0"
          >
            <p v-for="(item, i) in targetLog">{{ item }}</p>
          </a-card>
        </a-tab-pane>
      </a-tabs>
    </a-modal>
  </a-drawer>
</template>

<script setup>
import {
  message,
  Tooltip,
  Badge,
  Select, Input, Form, Modal
} from "ant-design-vue";
import {
  h,
  ref,
  reactive,
  watch,
  computed,
  onMounted,
  defineExpose,
  defineEmits,
  defineProps,
} from "vue";
import {
  CheckCircleOutlined,
  CloseCircleOutlined,
  DownOutlined,
  UpOutlined,
  PlusCircleOutlined,
  SearchOutlined,
  PlayCircleOutlined,
  PauseCircleOutlined,
  ExclamationCircleOutlined,
  ClockCircleFilled,
  StopOutlined,
  SyncOutlined,
  ReloadOutlined,
  DeleteOutlined,
  ToTopOutlined,
  DesktopOutlined,
  FilterOutlined,
  QuestionCircleOutlined,
  SettingOutlined,
  RedoOutlined,
  CloseOutlined
} from '@ant-design/icons-vue';
import * as http from "@/api/flow/index.js";
import { loadImage } from "@/hooks/loadImg";
import { start } from "nprogress";
const { loadImgMixin, loadAllPathImg } = loadImage();
function loadImg (url) {
  return loadAllPathImg(url);
}
const activeKey = ref('1');
const actives = ref(1);
const props = defineProps({
  show: {
    type: Boolean,
    required: true,
    default: false,
  },
});
const closes = (e) => {
  ws.value && ws.value.close();
  emit("closes");
};
const statusFn = (f) => {
  let s = {
    start: $t('realSyncDialog.start'),
    stop: $t('realSyncDialog.stop'),
    run: $t('realSyncDialog.run'),
    error: $t('realSyncDialog.core'),
    no_start: $t('realSyncDialog.nostart'),
  }
  if (s[f]) return s[f];
  if (!s[f]) return;
}

const open = ref(false);

const isSearchShow = ref(false);
const isSearchtwo = ref(false);

const ws = ref(null);
const syncSceneValue = ref();
const syncScene = ref([
  { show_info: "", id: "", show_desc: "", oper_code: "", oper_id: "" },
]);
const formState = ref([]);
const syncInputParams = ref([]);
const typeBatch = ref('start');
const typebtn = ref('start');
const istype = ref(true);
const start_stop = ref(false);
const status_obj = ref({
  error: 0,
  success: 0,
  num: 0,
  calculate: 0
});
const headerBtn = ref([])

const activeding = ref(false);
const leadingInfo = reactive({
  groupInfo: [],
  loading: false,
  fileList: [],
  select: '',
  batchID: '',
  tableData: [],
  columns: [
    {
      title: $t('realSyncDialog.serviceName'),
      dataIndex: "serviceName",
    },
    {
      title: $t('realSyncDialog.source_status'),
      dataIndex: "source_status",
    },
    {
      title: $t('realSyncDialog.target_status'),
      dataIndex: "target_status",
    },
    {
      title: $t('realSyncDialog.source_type'),
      dataIndex: "source_type",
    },
    {
      title: $t('realSyncDialog.target_type'),
      dataIndex: "target_type",
    },
    {
      title: $t('realSyncDialog.operation'),
      dataIndex: "operation",
      key: "operation",
    }
  ],
});
const getAllSceneInfo = (row) => {
  http.getAllSceneInfo({ dbType: row[0].dsType }).then(res => {
    const { code, data, msg } = res;
    if (code === '000000') {
      syncScene.value = data;
      const defScene = data.find(item => item.show_info == $t('realSyncDialog.qjs'));
      if (defScene) {
        syncSceneValue.value = defScene.id;
      }
    } else {
      message.error($t('realSyncDialog.doerror'));
    }
  })
}
const getSceneValueBySceneID = () => {
  http.getSceneValueBySceneID({ sceneID: syncSceneValue.value }).then(res => {
    const { code, data, msg } = res;
    if (code === '000000') {
      syncInputParams.value = data;
      formState.value = [];
    } else {
      message.error($t('realSyncDialog.doerror'));
    }
  })
}
// 表格目标端数据源个数
const getDtType = (type) => {
  if (type) {
    return type
  }
  return ''
}

const flowIds = ref([]);
const sourceLog = ref([]);
const targetLog = ref([]);
const targetstr = ref([]);
const initGroups = async (select) => {
  syncInputParams.value = []
  sourceLog.value = []
  targetLog.value = []
  targetstr.value = []
  headerBtn.value = {
    start: [
      { execType: "all", name: $t('realSyncDialog.allstart'), disabled: false },
      { execType: "source", name: $t('realSyncDialog.startsrc'), disabled: false },
      { execType: "target", name: $t('realSyncDialog.starttar'), disabled: false }
    ],
    stop: [
      { execType: "all", name: $t('realSyncDialog.allstop'), disabled: false },
      { execType: "No", name: $t('realSyncDialog.allfstop'), disabled: false },
      { execType: "source", name: $t('realSyncDialog.stopsrc'), disabled: false },
      { execType: "target", name: $t('realSyncDialog.stoptar'), disabled: false },
    ],
    run: [{ execType: "", name: $t('realSyncDialog.run'), disabled: false }]
  }

  getAllSceneInfo(select)
  leadingInfo.tableData = []
  typeBatch.value = 'start'
  typebtn.value = 'start'
  start_stop.value = false
  istype.value = new Set(select.map(item => item.dsType)).size <= 1
  flowIds.value = select.map(row => row.flowId);
  console.log(flowIds.value, 'aaaa')
  // leadingInfo.loading = true;
  let res = await http.getbatchList({
    operType: 'default',
    flowIds: flowIds.value.join(',')
  });
  leadingInfo.loading = false;
  if (res.code == "000000") {
    leadingInfo.tableData = res.data;
  } else {
    message.error(res.msg);
  }
};
// 更多功能
const handleMenuClick = async (e) => {
  console.log('Clicked menu key:', e.key);
  if (e.key == 'delete') {
    Modal.confirm({
      title: $t('realSyncDialog.conde'),
      content: $t('realSyncDialog.deAllTask'),
      okText: $t('realSyncDialog.sure'),
      cancelText: $t('realSyncDialog.cnacel'),
      onOk: async () => {
        typeBatch.value = 'delete'
        typebtn.value = 'delete'
        leadingInfo.batchID = Date.now()
        let res = await http.batcDeleteProcess({
          batchID: leadingInfo.batchID,
          flowIds: flowIds.value.join(',')
        });
        if (res.code == "000000") {
          start_stop.value = true
          batchWebSocket(leadingInfo.batchID, "")
        } else {
          message.error(res.msg);
        }
      }
    });
  }
};

//批量重置
const batcResetfn = async () => {
  Modal.confirm({
    title: $t('realSyncDialog.conreset'),
    content: $t('realSyncDialog.resetAllTask'),
    okText: $t('realSyncDialog.sure'),
    cancelText: $t('realSyncDialog.cnacel'),
    onOk: async () => {
      typeBatch.value = 'reset'
      typebtn.value = 'reset'
      leadingInfo.batchID = Date.now()
      let res = await http.batcResetProcess({
        batchID: leadingInfo.batchID,
        flowIds: flowIds.value.join(',')
      });
      if (res.code == "000000") {
        start_stop.value = true
        batchWebSocket(leadingInfo.batchID, "")
      } else {
        message.error(res.msg);
      }
    }
  });
}

// 批量启停
const batchExecCommand = async (operType, execType) => {
  leadingInfo.batchID = Date.now()
  typebtn.value = operType
  if (operType == 'run') {
    batchRunEngine(execType)
    return
  }
  console.log(operType, execType, headerBtn.value[operType], 'aaa21')
  if (execType == 'all') {
    headerBtn.value[operType].map(otem => {
      if (otem.execType != 'all') {
        otem.disabled = true
      }
    })
  }
  console.log(execType, 'execTypeexecTypeexecType')
  if (execType != 'No') {
    let res = await http.batchExecCommand({
      operType: operType,
      execType: execType,
      batchID: leadingInfo.batchID,
      flowIds: flowIds.value.join(',')
    });
    if (res.code == "000000") {
      start_stop.value = true
      batchWebSocket(leadingInfo.batchID, execType)
    } else {
      message.error(res.msg);
    }
  } else {
    let res = await http.batcStopJob({
      batchID: leadingInfo.batchID,
      flowIds: flowIds.value.join(',')
    });
    if (res.code == "000000") {
      start_stop.value = true
      batchWebSocket(leadingInfo.batchID, execType)
    } else {
      message.error(res.msg);
    }
  }
};

const batchRunEngine = async (execType) => {
  const values = arrToObj(formState.value)
  const sync = syncScene.value.find(item => item.id == syncSceneValue.value);
  console.log(sync, values, 'runrunrunru1')
  leadingInfo.batchID = Date.now()
  // leadingInfo.loading = true;
  let res = await http.batchRunEngine({
    pathList: '{}',
    execType: 'all',
    oper_code: sync?.oper_code,
    oper_id: sync?.oper_id,
    batchID: leadingInfo.batchID,
    flowIds: flowIds.value.join(','),
    ...values
  });
  // leadingInfo.loading = false;
  if (res.code == "000000") {
    start_stop.value = true
    batchWebSocket(leadingInfo.batchID, execType)
  } else {
    message.error(res.msg);
  }
};

const successBtn = (val) => {
  // leadingInfo.tableData
  if (val == 'success') {
    leadingInfo.tableData = tableNew.value.filter(item => item.cmd_type === "1");
  } else if (val == 'error') {
    leadingInfo.tableData = tableNew.value.filter(item => item.cmd_type === "-1");
  }
}
const lookLogs = (row) => {

  open.value = true;
  getBatchLog(row)
  return
}
const getBatchLog = (row) => {

  activeding.value = true
  http.getBatchLog({ operType: typeBatch.value, flowId: row.flowID }).then(res => {
    console.log("日志aaaaa")
    const { code, data, msg } = res;
    activeding.value = false
    if (code === '000000') {
      if (data.targetLog && data.targetLog.length > 0) {
        targetLog.value = data.targetLog;
        activeKey.value = '2';
      }
      if (data.target && data.target.length > 0) {
        targetstr.value = data.target;
        activeKey.value = '2';
      }
      if (data.sourceLog && data.sourceLog.length > 0) {
        sourceLog.value = data.sourceLog;
        activeKey.value = '1';
      }
    } else {
      message.error($t('realSyncDialog.doerror'));
    }
  })
}
const handleOk = (e) => {
  console.log(e);
  open.value = false;
};
const arrToObj = array => {
  const obj = {};
  for (const [index, value] of array.entries()) {
    obj['value' + (index + 1)] = value;
  }
  return obj;
}
const encode = (str) => {
  //加密两次
  // 对字符串进行编码
  var encode = encodeURI(str);
  // 对编码的字符串转化base64
  var base64 = btoa(encode);
  return base64;
};
/* 
  获取程序列表（ws)
*/
const tableNew = ref([]);
const batchWebSocket = async (batchId, execType) => {
  console.log(batchId, "batchId");
  let params = {
    batchId,
  };
  console.log("batchWebSocket()");
  let url = http.batchWebSocket();
  ws.value = new WebSocket(url + "/" + encode(`${JSON.stringify(params)}`));
  console.log(ws.value, "wsws");
  ws.value.addEventListener("message", function (event) {
    // event.data 包含了从服务器发送过来的数据
    console.log("Received data from server:", event.data);
    let res = JSON.parse(event.data);
    if (res.data && res.data.data && res.data.data.length > 0) {
      console.log(res, 'aaa')
      status_obj.value.success = res.data.success
      status_obj.value.error = res.data.error
      status_obj.value.num = res.data.success + res.data.error
      tableNew.value = res.data.data
      status_obj.value.calculate = res.data.calculate
      const tableDataMap = new Map();
      leadingInfo.tableData.forEach(ite => {
        tableDataMap.set(ite.flowID, ite);
      });
      // 然后遍历 res.data.data 数组
      res.data.data.forEach(item => {
        // 如果找到匹配项，则更新该对象
        const ite = tableDataMap.get(item.flow_id);
        if (ite) {
          ite.cmd_type = item.cmd_type;
          // 这里你可以添加新的属性或者修改已有的属性
          if (execType == 'source') {
            ite.source_status = item.source_status;
          } else if (execType == 'target') {
            ite.target_status = item.target_status;
          } else {
            ite.source_status = item.source_status;
            ite.target_status = item.target_status;
          }
        }
      });
      if (res.data.calculate == '100') {
        ws.value && ws.value.close();
        tableNew.value = JSON.parse(JSON.stringify(leadingInfo.tableData))
      }
    }

    // leadingInfo.tableData = res.data
    // 如果需要解析JSON数据
    try {
      const data = JSON.parse(event.data);
      console.log("Parsed data:", leadingInfo.tableData);
    } catch (e) {
      console.error("Failed to parse data as JSON:", e);
    }
  });
};


watch(typeBatch, () => {
  // 重置进度条状态
  status_obj.value = {
    error: 0,
    success: 0,
    num: 0,
    calculate: 0
  };
  start_stop.value = false; // 关闭进度显示
});
defineExpose({
  initGroups
})
const emit = defineEmits(["closes"]);
</script>

<style scoped lang="scss">
.rowmax p {
  margin-right: 10px;
  cursor: pointer;
}
::v-deep .ant-table-striped .ant-table-cell {
  padding: 8px !important;
}
</style>